#include "headfile.h"
#include "main.h"
#include "drive.h"
#include "initialization.h"
#include "electromagnetic.h"
#include "pid.h"
#include "element.h"




float InduError;
	
     void straight()
			{
      pwm_duty(PWMA_CH1P_P60, 0);   //初始化PWM0  使用后退引脚P60  输出PWM频率0HZ   占空比为百分之 0/PWM_DUTY_MAX*100
	    pwm_duty(PWMA_CH2P_P62, 0);//初始化PWM0  使用前进引脚P62  输出PWM频率0HZ   占空比为百分之 0/PWM_DUTY_MAX*100
			InduError =  InduSampling();	
			if (InduError < 0.2&& InduError > -0.24)//不用转
			{
				pwm_duty(PWMB_CH1_P74,775);
			}
			else if(InduError > 0.2)//要左转
			{
				pwm_duty(PWMB_CH1_P74,775+70);
			}
			else if(InduError < -0.24)//要右转
			{
				pwm_duty(PWMB_CH1_P74,775-70);
			}				

		else//不动
	  {
		   pwm_duty(PWMA_CH1P_P60, 0); 
		   pwm_duty(PWMA_CH2P_P62, 0);
			 pwm_duty(PWMB_CH1_P74,775);
		}
}
			
void annulus()
{
		   pwm_duty(PWMA_CH1P_P60, 0); 
		   pwm_duty(PWMA_CH2P_P62, 1500);
			 pwm_duty(PWMB_CH1_P74,775-60);
}






